<template>
  <div>
<!--    <el-form :model="from" :rules="rules" ref="ruleForm" class="demo-ruleForm">-->
<!--      <el-form-item label="姓名" prop="elderName" size="30px">-->
<!--        <el-input v-model="from.elderName"></el-input>-->
<!--      </el-form-item>-->
<!--      <el-form-item label="性别" prop="elderGender">-->
<!--        <el-select v-model="from.elderGender" placeholder="请选择">-->
<!--          <el-option label="男" value="男"></el-option>-->
<!--          <el-option label="女" value="女"></el-option>-->
<!--          <el-option label="保密" value="保密"></el-option>-->
<!--        </el-select>-->
<!--      </el-form-item>-->
<!--    </el-form>-->
    <el-form ref="form" :model="form" :rules="rules" label-width="180px">
      <el-form-item label="公寓Id" prop="apartmentId" width="50px" >
        <el-input v-model="form.apartmentId" placeholder="请输入公寓Id" />
      </el-form-item>
      <el-form-item label="老人图片" prop="elderImg">
        <el-input v-model="form.elderImg" placeholder="请输入老人图片" />
      </el-form-item>
      <el-form-item label="老人的姓名" prop="elderName">
        <el-input v-model="form.elderName" placeholder="请输入老人的姓名" />
      </el-form-item>
      <el-form-item label="老人的年龄" prop="elderAge">
        <el-input v-model="form.elderAge" placeholder="请输入老人的年龄" />
      </el-form-item>
      <el-form-item label="老人的性别" prop="elderGender">
        <el-input v-model="form.elderGender" placeholder="请输入老人的性别" />
      </el-form-item>
      <el-form-item label="老人的出生日期" prop="birthDate">
        <el-input v-model="form.birthDate" placeholder="请输入老人的出生日期" />
      </el-form-item>
      <el-form-item label="老人入住公寓的日期" prop="checkInTime">
        <el-input v-model="form.checkInTime" placeholder="请输入老人入住公寓的日期" />
      </el-form-item>
      <el-form-item label="老人离开公寓的日期" prop="checkOutTime">
        <el-input v-model="form.checkOutTime" placeholder="请输入老人离开公寓的日期" />
      </el-form-item>
      <el-form-item label="老人所分配的房间号码" prop="roomId">
        <el-input v-model="form.roomId" placeholder="请输入老人所分配的房间号码" />
      </el-form-item>
      <el-form-item label="老人所分配的床位号码" prop="bedCode">
        <el-input v-model="form.bedCode" placeholder="请输入老人所分配的床位号码" />
      </el-form-item>
      <el-form-item label="老人缴纳的押金金额" prop="deposit">
        <el-input v-model="form.deposit" placeholder="请输入老人缴纳的押金金额" />
      </el-form-item>
      <el-form-item label="老人的身份证号码" prop="identityCardNumber">
        <el-input v-model="form.identityCardNumber" placeholder="请输入老人的身份证号码" />
      </el-form-item>
      <el-form-item label="老人的紧急联系电话号码" prop="contactPhone">
        <el-input v-model="form.contactPhone" placeholder="请输入老人的紧急联系电话号码" />
      </el-form-item>
      <el-form-item label="老人的家庭住址信息" prop="homeAddress">
        <el-input v-model="form.homeAddress" placeholder="请输入老人的家庭住址信息" />
      </el-form-item>
      <el-form-item label="老人是否有过手术史的信息" prop="hasSurgeryHistory">
        <el-input v-model="form.hasSurgeryHistory" placeholder="请输入老人是否有过手术史的信息" />
      </el-form-item>
      <el-form-item label="老人是否患有慢性疾病的信息" prop="hasChronicDisease">
        <el-input v-model="form.hasChronicDisease" placeholder="请输入老人是否患有慢性疾病的信息" />
      </el-form-item>
      <el-form-item label="老人是否患有精神疾病的信息" prop="hasMentalIllness">
        <el-input v-model="form.hasMentalIllness" placeholder="请输入老人是否患有精神疾病的信息" />
      </el-form-item>
      <el-form-item label="老人是否患有传染性疾病的信息" prop="hasInfectiousDisease">
        <el-input v-model="form.hasInfectiousDisease" placeholder="请输入老人是否患有传染性疾病的信息" />
      </el-form-item>
      <el-form-item label="入住体检审核人员Id" prop="checkUserId">
        <el-input v-model="form.checkUserId" placeholder="请输入入住体检审核人员Id" />
      </el-form-item>
      <el-form-item label="是否异常 0 正常 1 异常" prop="isUnusual">
        <el-input v-model="form.isUnusual" placeholder="请输入是否异常 0 正常 1 异常" />
      </el-form-item>
      <el-form-item label="附件" prop="url">
        <el-input v-model="form.url" placeholder="请输入附件" />
      </el-form-item>
      <el-form-item label="是否删除 0 1" prop="isDelete">
        <el-input v-model="form.isDelete" placeholder="请输入是否删除 0 1" />
      </el-form-item>
      <el-form-item label="备注" prop="notes">
        <el-input v-model="form.notes" placeholder="请输入备注" />
      </el-form-item>
      <el-form-item label="入院审核人员姓名" prop="checkUserName">
        <el-input v-model="form.checkUserName" placeholder="请输入入院审核人员姓名" />
      </el-form-item>
      <el-form-item label="${comment}" prop="createUserId">
        <el-input v-model="form.createUserId" placeholder="请输入${comment}" />
      </el-form-item>
      <el-form-item label="${comment}" prop="updateUserId">
        <el-input v-model="form.updateUserId" placeholder="请输入${comment}" />
      </el-form-item>
    </el-form>
      <el-button type="primary" @click="submitForm">确 定</el-button>
      <el-button @click="cancel">取 消</el-button>
  </div>
</template>

<script>
  import {addElderInfo, updateElderInfo,getElderInfo} from "@/api/business/elderInfo";

  export default {
    data() {
      return {
        // 表单校验
        rules: {
        },
        form:{},
        param:{},
      }
    },
    created(){

    },
    methods: {
      getElderInfo(item){
        let id = item.elderId;
        getElderInfo(id).then(response => {
            this.form = response.data;
          console.log(this.form)
        })
      },
      /** 提交按钮 */
      submitForm() {
        this.$refs["form"].validate(valid => {
          if (valid) {
            if (this.form.id != null) {
              updateElderInfo(this.form).then(response => {
                this.$modal.msgSuccess("修改成功");
                this.open = false;
                // this.getList();
                this.$router.go(-1);
              });
            } else {
              addElderInfo(this.form).then(response => {
                this.$modal.msgSuccess("新增成功");
                this.open = false;
                // this.getList();
                this.$router.go(-1);
              });
            }
          }
        });
      },
      cancel(){
        this.$router.go(-1);
      }
    }
  }
</script>
<style></style>
